package de.rj.urwalking.data;

import android.content.Context;

import com.threed.jpct.Loader;
import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;

import de.rj.urwalking.R;

/**
 * 
 * A subclass of {@link SalientObject} that represents a landmark added by the
 * user.
 * 
 * @author rjj
 * 
 */

public class Pin extends SalientObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SimpleVector offset;

	public Pin(Context context) {
		super(Loader.loadOBJ(context.getResources().openRawResource(R.raw.pin_obj), context
				.getResources().openRawResource(R.raw.pin_mtl), 1.0f)[0]);

		
		setBillboarding(true);
		setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
		strip();
		build();

	}

	public double getRealX() {
		return (double) getOrigin().x + offset.x;
	}

	public double getRealY() {
		return (double) getOrigin().y + offset.y;
	}

	public void setOffset(SimpleVector offset) {

		this.offset = offset;
	}

	public boolean isExistingLandmark() {
		return wasPreviouslyALandmark() || super.hasUserDefinedName();
	}

	public void dontShowAsLandmark() {}

}
